<?php

class Kd_Data_Dcl_Expression_Relation extends Kd_Data_Dcl_Expression_Base {

    private $_table = '';
    private $_relationType = '';
    private $_left = '';
    private $_right = '';

    public function  __construct($table, $alias = '') {
        parent::__construct();
        $this->setTable($table, $alias);
    }

    public function on($left, $right){
        return $this->setLeft($left)->setRight($right);
    }

    public function getTable(){
        return $this->_table;
    }
    public function setTable($name, $alias = ''){
        $this->_table = new Kd_Data_Dcl_Expression_Table($name, $alias);
        return $this;
    }

    public function getRelationType(){
        return $this->_relationType;
    }
    public function setRelationType($value){
        $this->_relationType = $value;
        return $this;
    }

    public function getLeft(){
        return $this->_left;
    }
    public function setLeft($value){
        $this->_left = new Kd_Data_Dcl_Expression_Field($value);
        return $this;
    }

    public function getRight(){
        return $this->_right;
    }
    public function setRight($value){
        $this->_right = new Kd_Data_Dcl_Expression_Field($value);
        return $this;
    }

    public function getExpressionType(){
        return 'relation';
    }
}